package org.zjt.servletdemo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.zjt.servletdemo.domain.User;
import org.zjt.servletdemo.service.IUserService;
import org.zjt.servletdemo.service.UserService2;
import org.zjt.servletdemo.service.UserService3;


@RestController
public class DataSourceTestController {

    @Autowired
    private IUserService userService;

    @Autowired
    private UserService2 userService2;

    @Autowired
    private UserService3 userService3;


    @PostMapping("/save/user")
    public void save(@RequestBody User user) {
        try {
            userService.saveUser(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @PostMapping("/save/user2")
    public void save2(@RequestBody User user) {
        try {
            userService2.saveUser(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @PostMapping("/save/user3")
    public void save3(@RequestBody User user) {
        try {
            userService3.saveUser(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
